﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using GBL.Repository.Resources;
using GBlasonLogic.Tools;

namespace GBlasonLogic.Rules
{
    public class PointsGeometry : Dictionary<Points, Func<Geometry, Geometry>>
    {
        private static PointsGeometry _singleton;
        public static PointsGeometry Singleton
        {
            get { return _singleton ?? (_singleton = new PointsGeometry()); }
        }

        public static Func<Geometry, Geometry> FromPoint(Points point)
        {
            return Singleton[point];
        }

        private PointsGeometry()
        {
            Add(Points.FessBottom, GeometryTools.GetBottomHalf);
            Add(Points.FessTop, GeometryTools.GetBottomTop);
            Add(Points.PaleLeft, GeometryTools.GetLeftHalf);
            Add(Points.PaleRight, GeometryTools.GetRightHalf);
            Add(Points.BendBottom, GeometryTools.GetBottomLeftHalf);
            Add(Points.BendTop, GeometryTools.GetTopRightHalf);
            Add(Points.BendSinisterBottom, GeometryTools.GetBottomRightHalf);
            Add(Points.BendSinisterTop, GeometryTools.GetTopLeftHalf);
            Add(Points.SaltireLeft, GeometryTools.GetDiagonalRight);
            Add(Points.SaltireBottom, GeometryTools.GetDiagonalBottom);
            Add(Points.SaltireRight, GeometryTools.GetDiagonalLeft);
            Add(Points.SaltireTop, GeometryTools.GetDiagonalTop);
        }
    }
}
